package com.zhoug.common.permission2;

import android.app.AlertDialog;
import android.content.Context;

import com.zhoug.common.R;

import androidx.annotation.NonNull;

/**
 * @Author 35574
 * @Date 2021/6/7
 * @Description
 */
class PermissionDescriptionDialog implements IPermissionDescriptionDialog {

    public void show(Context context, String description, @NonNull Callback callback) {
        AlertDialog alertDialog = new AlertDialog.Builder(context, R.style.common_style_permissionDialog)
                .setMessage(description)
                .setPositiveButton("去授权", (dialog, which) -> {
                    dialog.dismiss();
                    callback.onConfirm();
                })
                .setNegativeButton("拒绝", (dialog, which) -> {
                    dialog.dismiss();
                    callback.onRefuse();
                })
                .create();
        alertDialog.setCancelable(false);
        alertDialog.show();
    }


}
